/*
 * rewarn_pkt.h
 *
 *  Created on: 2009-5-25
 *      Author: tulai
 */

#ifndef REWARN_PKT_H_
#define REWARN_PKT_H_

#include <packet.h>

#define HDR_REWARN_PKT(p) ((struct hdr_rewarn_pkt*)hdr_rewarn_pkt::access(p))
#define HDR_RWRELAY_PKT(p) ((struct hdr_rwrelay_pkt*)hdr_rwrelay_pkt::access(p))



struct hdr_rewarn_pkt {
  double timestamp;
  nsaddr_t src_addr_; //node which originated this packet

  u_int16_t posx;
  u_int16_t posy;
  double velocity;
  double yaw;
  double accx;
  double accy;
  double ttx;

  nsaddr_t tar_addr;
  static int offset_;
  inline static int& offset() {return offset_;}
  inline static hdr_rewarn_pkt* access(const Packet* p){
    return (hdr_rewarn_pkt*)p->access(offset_);
  }

};

struct hdr_rwrelay_pkt {
  double timestamp1;
  nsaddr_t party1;
  u_int16_t posx1;
  u_int16_t posy1;
  double velocity1;
  double yaw1;
  double accx1;
  double accy1;


  double timestamp2;
  nsaddr_t party2;
  u_int16_t posx2;
  u_int16_t posy2;
  double velocity2;
  double yaw2;
  double accx2;
  double accy2;


  double ttx;
  static int offset_;
  inline static int& offset() {return offset_;}
  inline static hdr_rwrelay_pkt* access(const Packet* p){
     return (hdr_rwrelay_pkt*)p->access(offset_);
  }
};

#endif /* REWARN_PKT_H_ */
